{{include template('public/header','admin')}}
<style>
    .tab-pane fieldset {
        border: 1px solid #d8d8d8;
        padding: 10px;
        margin-bottom: 15px;
    }
    .tab-pane fieldset legend {
        background-color: #f9f9f9;
        border: 1px solid #d8d8d8;
        font-weight: bold;
        font-size: 14px;
        padding: 3px 8px;
        color: #444;
        width: auto;
        line-height: 25px;
        margin-bottom: 0px;
    }
</style>
<body>
    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <form onsubmit="return check()" method="post" class="form form-horizontal" id="cpform" name="cpform" role="form" autocomplete='off' >
                    <ul id="myTab" class="nav nav-tabs">
                        <li class="active"><a href="#setting_base" data-toggle="tab">列表网址规则</a></li>
                        <li><a href="#details" data-toggle="tab">文章网址规则</a></li>
                        <li><a href="#rests" data-toggle="tab">其他设置</a></li>
                    </ul>
                    <div id="myTabContent" class="tab-content">
                        <div class="tab-pane fade in active" id="setting_base"><br>
                            <fieldset>
                                <legend>基本信息</legend>
                                <table width="100%" class="table table-border ticky_table">
                                    <tr>
                                        <td width="120">采集项目名：</td>
                                        <td class="form-inline">
                                            <input type="text" name="name" value="{{$item.name}}" class="form-control" style=" width: 100%;" ></input>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="120">采集页面编码：</td>
                                        <td class="form-inline">
                                            <label class="radio-inline">
                                                <input type="radio" class="radio" name="sourcecharset" value="utf-8" {{if $item.sourcecharset== 'utf-8'}}checked{{/if}} > UTF-8
                                            </label>&nbsp;&nbsp;
                                            <label class="radio-inline">
                                                <input type="radio" class="radio" name="sourcecharset" value="gbk" {{if $item.sourcecharset== 'gbk'}}checked{{/if}}> GBK
                                            </label>
                                        </td>
                                    </tr>
                                </table>
                            </fieldset>

                            <fieldset>
                                <legend>列表规则</legend>
                                <table width="100%" class="table table-border ticky_table">
                                    <tr>
                                        <td width="120">网址类型：</td>
                                        <td class="form-inline">
                                            <label class="radio-inline"><input type="radio" class="radio" name="sourcetype" value="1" {{if $item.sourcetype== '1'}}checked{{/if}} > 序列网址</label>&nbsp;&nbsp;
                                            <label class="radio-inline"><input type="radio" class="radio" name="sourcetype" value="2" {{if $item.sourcetype== '2'}}checked{{/if}} > 单一网页</label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="120">网址配置：</td>
                                        <td class="form-inline">
                                            <input type="text" name="urlpage" class="form-control" value="{{$item.urlpage}}" style=" width: 100%;" />
                                            <span class="help-block">(如为序列网址：http://www.xxxx.com/html/(*).html，页码使用(*)做为通配符。</span>
                                            页码从: <input type="text" name="pagesize_start" value="{{$item.pagesize_start}}" class="form-control" style="width:60px"> 到
                                            <input type="text" name="pagesize_end" value="{{$item.pagesize_end}}" class="form-control" style="width:60px"> 每次增加
                                            <input type="text" name="par_num" class="form-control" style="width:60px" value="{{$item.par_num}}">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="120">网址配置：</td>
                                        <td class="form-inline">
                                            网址中必须包含 <input type="text" name="url_contain"  value="{{$item.url_contain}}" class="form-control">
                                            网址中不得包含 <input type="text" name="url_except"  value="{{$item.url_except}}" class="form-control w_300">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="120">获取网址：</td>
                                        <td>
                                            区域开始的HTML：<textarea name="url_start" class="form-control mb-5" rows="5">{{$item.url_start}}</textarea><br>
                                            区域结束的HTML：<textarea name="url_end" class="form-control"  rows="5">{{$item.url_end}}</textarea> </td>
                                    </tr>
                                </table>
                            </fieldset>

                        </div>
                        <div class="tab-pane fade" id="details"><br>
                            <fieldset>
                                <legend>标题规则</legend>
                                <table width="100%" class="table table-border ticky_table">
                                    <tr>
                                        <td width="120">匹配规则：</td>
                                        <td>
                                            <textarea name="title_rule" class="form-control" style="width:450px;" rows="5">{{$item.title_rule}}</textarea> <span class="c-red">使用“[内容]”作为通配符 </span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="120">过滤选项：</td>
                                        <td>
                                            <textarea name="title_html_rule" class="form-control" style="width:450px;"rows="5">{{$item.title_html_rule}}</textarea> <span class="c-red">使用“[|]”分割多个规则 </span><br/>
                                            选择：
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_1" onclick="html_role('html_rule_1', 'title_html_rule')" value="<p([^>]*)>(.*)</p>" type="checkbox"> &lt;p&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_1" onclick="html_role('html_rule_1', 'title_html_rule')" value="<a([^>]*)>(.*)</a>" type="checkbox"> &lt;a&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_1" onclick="html_role('html_rule_1', 'title_html_rule')" value="<script([^>]*)>(.*)</script>" type="checkbox"> &lt;script&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_1" onclick="html_role('html_rule_1', 'title_html_rule')" value="<iframe([^>]*)>(.*)</iframe>" type="checkbox"> &lt;iframe&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_1" onclick="html_role('html_rule_1', 'title_html_rule')" value="<table([^>]*)>(.*)</table>" type="checkbox"> &lt;table&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_1" onclick="html_role('html_rule_1', 'title_html_rule')" value="<span([^>]*)>(.*)</span>" type="checkbox"> &lt;span&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_1" onclick="html_role('html_rule_1', 'title_html_rule')" value="<b([^>]*)>(.*)</b>" type="checkbox"> &lt;b&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_1" onclick="html_role('html_rule_1', 'title_html_rule')" value="<img([^>]*)>" type="checkbox"> &lt;img&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_1" onclick="html_role('html_rule_1', 'title_html_rule')" value="<object([^>]*)>(.*)</object>" type="checkbox"> &lt;object&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_1" onclick="html_role('html_rule_1', 'title_html_rule')" value="<embed([^>]*)>(.*)</embed>" type="checkbox"> &lt;embed&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_1" onclick="html_role('html_rule_1', 'title_html_rule')" value="<param([^>]*)>(.*)</param>" type="checkbox"> &lt;param&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_1" onclick="html_role('html_rule_1', 'title_html_rule')" value="<div([^>]*)>" type="checkbox"> &lt;div&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_1" onclick="html_role('html_rule_1', 'title_html_rule')" value="</div>" type="checkbox"> &lt;/div&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_1" onclick="html_role('html_rule_1', 'title_html_rule')" value="<!--([^>]*)-->" type="checkbox"> &lt;!-- --&gt;</label>
                                        </td>
                                    </tr>
                                </table>
                            </fieldset>

                            <fieldset>
                                <legend>时间规则</legend>
                                <table width="100%" class="table table-border ticky_table">
                                    <tr>
                                        <td width="120">匹配规则：</td>
                                        <td>
                                            <textarea name="time_rule" class="form-control" style="width:450px;" rows="5">{{$item.time_rule}}</textarea> <span class="c-red">使用“[内容]”作为通配符 </span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="120">过滤选项：</td>
                                        <td>
                                            <textarea name="time_html_rule" class="form-control" style="width:450px;" rows="5">{{$item.time_html_rule}}</textarea> <span class="c-red">使用“[|]”分割多个规则 </span><br/>
                                            选择：
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_2" onclick="html_role('html_rule_2', 'time_html_rule')" value="<p([^>]*)>(.*)</p>" type="checkbox"> &lt;p&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_2" onclick="html_role('html_rule_2', 'time_html_rule')" value="<a([^>]*)>(.*)</a>" type="checkbox"> &lt;a&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_2" onclick="html_role('html_rule_2', 'time_html_rule')" value="<script([^>]*)>(.*)</script>" type="checkbox"> &lt;script&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_2" onclick="html_role('html_rule_2', 'time_html_rule')" value="<iframe([^>]*)>(.*)</iframe>" type="checkbox"> &lt;iframe&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_2" onclick="html_role('html_rule_2', 'time_html_rule')" value="<table([^>]*)>(.*)</table>" type="checkbox"> &lt;table&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_2" onclick="html_role('html_rule_2', 'time_html_rule')" value="<span([^>]*)>(.*)</span>" type="checkbox"> &lt;span&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_2" onclick="html_role('html_rule_2', 'time_html_rule')" value="<b([^>]*)>(.*)</b>" type="checkbox"> &lt;b&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_2" onclick="html_role('html_rule_2', 'time_html_rule')" value="<img([^>]*)>" type="checkbox"> &lt;img&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_2" onclick="html_role('html_rule_2', 'time_html_rule')" value="<object([^>]*)>(.*)</object>" type="checkbox"> &lt;object&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_2" onclick="html_role('html_rule_2', 'time_html_rule')" value="<embed([^>]*)>(.*)</embed>" type="checkbox"> &lt;embed&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_2" onclick="html_role('html_rule_2', 'time_html_rule')" value="<param([^>]*)>(.*)</param>" type="checkbox"> &lt;param&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_2" onclick="html_role('html_rule_2', 'time_html_rule')" value="<div([^>]*)>" type="checkbox"> &lt;div&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_2" onclick="html_role('html_rule_2', 'time_html_rule')" value="</div>" type="checkbox"> &lt;/div&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_2" onclick="html_role('html_rule_2', 'time_html_rule')" value="<!--([^>]*)-->" type="checkbox"> &lt;!-- --&gt;</label>
                                        </td>
                                    </tr>
                                </table>
                            </fieldset>

                            <fieldset>
                                <legend>内容规则</legend>
                                <table width="100%" class="table table-border ticky_table">
                                    <tr>
                                        <td width="120">匹配规则：</td>
                                        <td>
                                            <textarea name="content_rule" class="form-control" style="width:450px;" rows="5">{{$item.content_rule}}</textarea> <span class="c-red">使用“[内容]”作为通配符 </span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="120">过滤选项：</td>
                                        <td>
                                            <textarea name="content_html_rule" class="form-control" style="width:450px;" rows="5">{{$item.content_html_rule}}</textarea> <span class="c-red">使用“[|]”分割多个规则 </span><br/>
                                            选择：
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_3" onclick="html_role('html_rule_3', 'content_html_rule')" value="<p([^>]*)>(.*)</p>" type="checkbox"> &lt;p&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_3" onclick="html_role('html_rule_3', 'content_html_rule')" value="<a([^>]*)>(.*)</a>" type="checkbox"> &lt;a&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_3" onclick="html_role('html_rule_3', 'content_html_rule')" value="<script([^>]*)>(.*)</script>" type="checkbox"> &lt;script&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_3" onclick="html_role('html_rule_3', 'content_html_rule')" value="<iframe([^>]*)>(.*)</iframe>" type="checkbox"> &lt;iframe&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_3" onclick="html_role('html_rule_3', 'content_html_rule')" value="<table([^>]*)>(.*)</table>" type="checkbox"> &lt;table&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_3" onclick="html_role('html_rule_3', 'content_html_rule')" value="<span([^>]*)>(.*)</span>" type="checkbox"> &lt;span&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_3" onclick="html_role('html_rule_3', 'content_html_rule')" value="<b([^>]*)>(.*)</b>" type="checkbox"> &lt;b&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_3" onclick="html_role('html_rule_3', 'content_html_rule')" value="<img([^>]*)>" type="checkbox"> &lt;img&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_3" onclick="html_role('html_rule_3', 'content_html_rule')" value="<object([^>]*)>(.*)</object>" type="checkbox"> &lt;object&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_3" onclick="html_role('html_rule_3', 'content_html_rule')" value="<embed([^>]*)>(.*)</embed>" type="checkbox"> &lt;embed&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_3" onclick="html_role('html_rule_3', 'content_html_rule')" value="<param([^>]*)>(.*)</param>" type="checkbox"> &lt;param&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_3" onclick="html_role('html_rule_3', 'content_html_rule')" value="<div([^>]*)>" checked type="checkbox"> &lt;div&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_3" onclick="html_role('html_rule_3', 'content_html_rule')" value="</div>" checked type="checkbox"> &lt;/div&gt;</label>
                                            <label style="margin-right:10px;font-weight:100;"><input name="html_rule_3" onclick="html_role('html_rule_3', 'content_html_rule')" value="<!--([^>]*)-->"  type="checkbox"> &lt;!-- --&gt;</label>
                                        </td>
                                    </tr>
                                </table>
                            </fieldset>

                        </div>
                        <div class="tab-pane fade" id="rests"><br>
                            <fieldset>
                                <legend>其他设置</legend>
                                <table class="table table-border ticky_table">
                                    <tr>
                                        <td width="180">下载图片：</td>
                                        <td>
                                            <label  class="radio-inline"><input name="down_attachment" value="1" class="radio" type="radio" {{if $item.down_attachment== '1'}}checked{{/if}} >下载图片</label>&nbsp;&nbsp;
                                            <label  class="radio-inline"><input name="down_attachment" value="0" class="radio" type="radio" {{if $item.down_attachment== '0'}}checked{{/if}} >不下载</label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>导入顺序：</td>
                                        <td>
                                            <label  class="radio-inline"><input name="coll_order" value="1" class="radio" type="radio" {{if $item.coll_order== '1'}}checked{{/if}} >与目标站相同</label>&nbsp;&nbsp;
                                            <label  class="radio-inline"><input name="coll_order" value="0" class="radio" type="radio" {{if $item.coll_order== '0'}}checked{{/if}} >与目标站相反</label>
                                        </td>
                                    </tr>
                                </table>
                            </fieldset>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-10">
                            <input type='submit' name='dosubmit' class='btn btn-primary' value='提交' />
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        function check() {
            if ($("input[name='name']").val() == '') {
                layer.alert('采集项目名不能为空！');
                return false;
            }
            if ($("input[name='urlpage']").val() == '') {
                layer.alert('网址配置不能为空！');
                return false;
            }
        }
        function html_role(id, textid) {
            var result = "";
            $("input[name='" + id + "']:checked").each(function () {
                result += $(this).val() + '[|]' + "\n";
            });
            $("textarea[name='" + textid + "']").val(result);
        }
    </script>

</body>
</html>
